<template>
    <div>
        <script id="editor" type="text/plain"></script>
    </div>
</template>

<script>
import '../../../public/ue/ueditor.config.js';
import '../../../public/ue/ueditor.all.js';
import '../../../public/ue/lang/zh-cn/zh-cn.js';

export default {
    name: 'ue',
    data () {
        return {
            editor: null,
            config: {
                serverUrl: "/api/ue/exec?imgType=img"
            }
        }
    },
    props: {
        defaultMsg: {
            type: String
        },
    },
    mounted() {
        this.config.initialFrameHeight='600';
        this.editor = UE.getEditor('editor', this.config); // 初始化UE

        const _this = this;
        this.editor.addListener("ready", function () {
            _this.editor.setContent(_this.defaultMsg); // 确保UE加载完成后，放入内容。
        });
    },
    methods : {
        getUEContent() { // 获取内容方法
            return this.editor.getContent()
        },  
    },
    destroyed() {
        this.editor.destroy();
    }
}
</script>




